Skip to content

docs: add durable example - #253

Merged
karel-rehor merged 12 commits into
mainfrom
example/durable-example
Aug 4, 2025
Merged

docs: add durable example#253
karel-rehor merged 12 commits into
mainfrom
example/durable-example

Conversation

@karel-rehor

@karel-rehor karel-rehor commented Aug 1, 2025

Copy link
Copy Markdown
Contributor

Proposed Changes

Adds an example showing how to reuse and keep alive client instances for the duration of an application, as recommended in GRPC Best Practices. Clients should be created or recreated as little as possible and should be reused as much as possible.

The example illustrates using a primitive client pool that manages client instances while running four threads simultaneously handling influxdb calls. Two of these threads produce error responses from the server. Clients recover from these errors and can still be used for other calls.

This was motivated by research into a customer question about using connection pools for the query transport. Connection pools are already handled by the underlying GRPC ManagedChannel, which is designed to be long-running and robust. The write transport is similarly designed to recover from typical error responses.

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate - not needed
  • Tests pass
  • Commit messages are conventional
  • Sign CLA (if not already signed)

@codecov

codecov Bot commented Aug 1, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.14%. Comparing base (845dfb2) to head (010fa6a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #253   +/-   ##
=======================================
  Coverage   90.14%   90.14%           
=======================================
  Files          20       20           
  Lines        1207     1207           
  Branches      188      188           
=======================================
  Hits         1088     1088           
  Misses         42       42           
  Partials       77       77           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jansimonb jansimonb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, just few comments.

Comment thread examples/src/main/java/com/influxdb/v3/durable/InfluxClientPool.java Outdated
Comment thread examples/src/main/java/com/influxdb/v3/durable/DurableExample.java Outdated
@karel-rehor

Copy link
Copy Markdown
Contributor Author

@jansimonb

I've made some recommended changes. I've also expanded explanations in comments. Since I ran across a flaky test failure in QueryOptonsTest.java following a couple of commits, I decided to make a small change to clear up some of the flake. It seems when tests run in parallel a fixed port value has been causing an occasional BindException.

@karel-rehor
karel-rehor requested a review from jansimonb August 4, 2025 15:12

@jansimonb jansimonb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! 👍

@karel-rehor
karel-rehor merged commit 119d3ea into main Aug 4, 2025
9 checks passed
@karel-rehor
karel-rehor deleted the example/durable-example branch August 4, 2025 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants